<?php 
define('PAGE_NEED_PRI','PRI_EDIT');
session_start();
include_once "main.php";
?>
<?php  include("admin.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> Bios 管理中心 </title>
<link href="../css/control.css" rel="stylesheet" type="text/css" />



</head>

<body>


<a name="top" id="top"></a>
<div id="all"><!--Wrap start //-->
<div id="main" class="clearfix"><!--main start //-->
<div id="top-1"><?php include_once('blog_top_btn.php');?>
</div>
<!--Content for  id "submenu" Goes Here //-->
<div id="submenu">
<?php include_once('admin_main_btn.php');?>
  </div>
 <!--Content for  id "contact" Goes Here //-->
 <div id="contact-admin">
   
   
   
   
   
   
<?php 
$linkname="admin-acc-no-main";
?> 
   
   
   
   
   
      <?php 
//修改數據
$id=make_safe($_GET["id"]);
$action=make_safe($_GET["action"]);
$lb1=make_safe($_POST["lb1"]);
$lb2=make_safe($_POST["lb2"]);
$mastereditname1=make_safe($_POST["mastereditname1"]);
$mastereditname2=make_safe($_POST["mastereditname2"]);
$editname2=make_safe($_POST["editname2"]);

$mastersalename1=make_safe($_POST["mastersalename1"]);
$mastersalename2=make_safe($_POST["mastersalename2"]);
$salename2=make_safe($_POST["salename2"]);


$box1=make_safe($_POST["box1"]);
$box2=make_safe($_POST["box2"]);
$box3=make_safe($_POST["box3"]);
$box4=make_safe($_POST["box4"]);
$box5=make_safe($_POST["box5"]);
$box6=make_safe($_POST["box6"]);
$box7=make_safe($_POST["box7"]);
$box8=make_safe($_POST["box8"]);
$box9=make_safe($_POST["box9"]);

if($box1==""){$box1=0;}
if($box2==""){$box2=0;}
if($box3==""){$box3=0;}
if($box4==""){$box4=0;}
if($box5==""){$box5=0;}
if($box6==""){$box6=0;}
if($box7==""){$box7=0;}
if($box8==""){$box8=0;}
if($box9==""){$box9=0;}



$a1=make_safe($_POST["a1"]);
$a2=make_safe($_POST["a2"]);
$a3=make_safe($_POST["a3"]);
$a4=make_safe($_POST["a4"]);
$a5=make_safe($_POST["a5"]);
$a6=make_safe($_POST["a6"]);
$a7=make_safe($_POST["a7"]);
$a8=make_safe($_POST["a8"]);
$a9=make_safe($_POST["a9"]);

if($a1==""){$a1=0;}
if($a2==""){$a2=0;}
if($a3==""){$a3=0;}
if($a4==""){$a4=0;}
if($a5==""){$a5=0;}
if($a6==""){$a6=0;}
if($a7==""){$a7=0;}
if($a8==""){$a8=0;}
if($a9==""){$a9=0;}


if($action=="xiugai" and $box1=="1"){
if($query=mysql_query("update guanli set box1='$box1' where id='$id'"))
{
echo "<script>alert('資料修改成功！');window.location.href='".$linkname.".php?page=".$page."';</script>";
}
else
{
echo "<script>alert('資料修改失敗！');window.location.href='".$linkname.".php?page=".$page."';</script>";
}
}

if($action=="xiugai" and $box2=="1"){
if($query=mysql_query("update guanli set box2='$box2' where id='$id'"))
{
echo "<script>alert('資料修改成功！');window.location.href='".$linkname.".php?page=".$page."';</script>";
}
else
{
echo "<script>alert('資料修改失敗！');window.location.href='".$linkname.".php?page=".$page."';</script>";
}
}


if($action=="xiugai" and $box3=="1"){
if($query=mysql_query("update guanli set box3='$box3',mastereditname='$mastereditname1' where id='$id'"))
{
echo "<script>alert('資料修改成功！');window.location.href='".$linkname.".php?page=".$page."';</script>";
}
else
{
echo "<script>alert('資料修改失敗！');window.location.href='".$linkname.".php?page=".$page."';</script>";
}
}


if($action=="xiugai" and $box4=="1"){
if($query=mysql_query("update guanli set box4='$box4',mastereditname='$mastereditname2',editname='$editname2',a1='$a1',a2='$a2',a3='$a3',a4='$a4',a5='$a5',a6='$a6',a7='$a7',a8='$a8',a9='$a9'  where id='$id'"))
{
echo "<script>alert('資料修改成功！');window.location.href='".$linkname.".php?page=".$page."';</script>";
}
else
{
echo "<script>alert('資料修改失敗！');window.location.href='".$linkname.".php?page=".$page."';</script>";
}
}








?>


     <?php 
   $id=make_safe($_GET["id"]);   
    $sql="select * from guanli where id='$id' ";	
	$result=mysql_query($sql);
	$row=mysql_fetch_assoc($result);
	?>

   <form   action="?action=xiugai&id=<?php echo $id;?>" method="post" name="form1"  >
   

   
     <table border="0" cellspacing="0" cellpadding="0">
     <tr>
       <td>帳號權限設定：</td>
     </tr>
     <tr>
       <td id="bumeng1" ><ul>
 		<li>
          <input name="box1" type="checkbox"  value="1"  <?php if($row["box1"]==1){echo "checked='checked'";}?>/>
          系統管理</li>
          
         <li>
          <input name="box2" type="checkbox"  value="1"  <?php if($row["box2"]==1){echo "checked='checked'";}?>/>
          master edit</li>
		   
		 <li>
         <input name="box4" type="checkbox"   value="1"   <?php if($row["box4"]==1){echo "checked='checked'";}?> />          
         blog</li>
         
     
	
     
    	<li>
					
          <input name="box3" type="checkbox"  value="1"    <?php if($row["box3"]==1){echo "checked='checked'";}?> />
          sale</li>
         
       </ul>
       </td>
     </tr>
     

	 
	 <tr>
       <td ><ul>
         <li>&nbsp;</li>
         <li>
           <input type="submit" name="Submit" value="提交保存"  />
         </li></ul></td>
	   
     </tr>
	 
   </table>
    </form>
   
   
   
   
   
   
   
   
   


   
   
   
   
   
   
   
   
  
   <table border="0" cellspacing="0" cellpadding="0">
     <tr>
       <td colspan="2">帳號相關資訊：</td>
     </tr>
     
     
	 <tr>
       <td class="contact-admin-l">登入帳號：</td>
       <td class="contact-admin-r"><?php echo $row->username;?></td>
     </tr>
     <tr>
       <td class="contact-admin-l">登入密碼：</td>
       <td class="contact-admin-r"><?php echo $row->password;?></td>
     </tr>
	
	 
	 <tr>
       <td class="contact-admin-l">姓名：</td>
       <td class="contact-admin-r"><label for="textfield2"></label>
         <?php echo $row->name;?></td>
     </tr>
	 
     <tr>
       <td class="contact-admin-l">電子郵件：</td>
       <td class="contact-admin-r"><?php echo $row->email;?></td>
     </tr>
	 <tr>
       <td class="contact-admin-l">MSN：</td>
       <td class="contact-admin-r"><?php echo $row->msn;?></td>
     </tr>
     <tr>
       <td class="contact-admin-l">連絡電話：</td>
       <td class="contact-admin-r"><?php echo $row->tel;?></td>
     </tr>
     <tr>
       <td class="contact-admin-l">個人網址：</td>
       <td class="contact-admin-r"><?php echo $row->address;?></td>
     </tr>
   
   </table>

   
   
   
   
   
   
   
   

   
   
   
   
   
   
   
   
   
   
   
   
   
   
 </div>
</div><!-- main end //-->
</div><!--Wrap end //-->
<div id="botton">
 <?php include_once('blog_botton_btn.php');?>
</div>






   
 <script language="javascript">

	function check_bumeng1(){
j=document.getElementById("bumeng1");
j.style.display = "block";

k=document.getElementById("bumeng2");
k.style.display = "none";
document.getElementById("lb1").checked=true;
document.getElementById("lb2").checked=false;
if(document.getElementById("box3").checked==true){
document.getElementById("edit1").style.display = "block";
}

if(document.getElementById("box4").checked==true){
document.getElementById("edit2").style.display = "block";
document.getElementById("blog").style.display = "block";
}



document.getElementById("sale1").style.display = "none";
document.getElementById("sale2").style.display = "none";
}

function check_bumeng2(){
j=document.getElementById("bumeng1");
j.style.display = "none";

k=document.getElementById("bumeng2");
k.style.display = "block";
document.getElementById("lb1").checked=false;
document.getElementById("lb2").checked=true;
document.getElementById("edit1").style.display = "none";
document.getElementById("edit2").style.display = "none";
document.getElementById("blog").style.display = "none";


if(document.getElementById("box6").checked==true){
document.getElementById("sale1").style.display = "block";
}
if(document.getElementById("box7").checked==true){
document.getElementById("sale2").style.display = "block";
}

}

function check_box2(){
if(document.getElementById("box2")!=null){
document.getElementById("box2").checked=true;
}
document.getElementById("box3").checked=false;
document.getElementById("box4").checked=false;
document.getElementById("edit1").style.display = "none";
document.getElementById("edit2").style.display = "none";
document.getElementById("blog").style.display = "none";
document.getElementById("sale1").style.display = "none";
document.getElementById("sale2").style.display = "none";
}

function check_box3(){
if(document.getElementById("box2")!=null){
document.getElementById("box2").checked=false;
}
document.getElementById("box3").checked=true;
document.getElementById("box4").checked=false;

document.getElementById("edit1").style.display = "block";

document.getElementById("edit2").style.display = "none";
document.getElementById("blog").style.display = "none";
document.getElementById("sale1").style.display = "none";
document.getElementById("sale2").style.display = "none";
}

function check_box4(){
if(document.getElementById("box2")!=null){
document.getElementById("box2").checked=false;
}
document.getElementById("box3").checked=false;
document.getElementById("box4").checked=true;
document.getElementById("edit1").style.display = "none";
document.getElementById("edit2").style.display = "block";
document.getElementById("blog").style.display = "block";
document.getElementById("sale1").style.display = "none";
document.getElementById("sale2").style.display = "none";
}


function check_box5(){
document.getElementById("box5").checked=true;
document.getElementById("box6").checked=false;
document.getElementById("box7").checked=false;
document.getElementById("edit1").style.display = "none";
document.getElementById("edit2").style.display = "none";
document.getElementById("blog").style.display = "none";
document.getElementById("sale1").style.display = "none";
document.getElementById("sale2").style.display = "none";
}

function check_box6(){
if(document.getElementById("box5")!=null){
document.getElementById("box5").checked=false;
}
document.getElementById("box6").checked=true;
document.getElementById("box7").checked=false;
document.getElementById("edit1").style.display = "none";
document.getElementById("edit2").style.display = "none";
document.getElementById("blog").style.display = "none";
document.getElementById("sale1").style.display = "block";
document.getElementById("sale2").style.display = "none";
}

function check_box7(){
if(document.getElementById("box5")!=null){
document.getElementById("box5").checked=false;
}
document.getElementById("box6").checked=false;
document.getElementById("box7").checked=true;
document.getElementById("edit1").style.display = "none";
document.getElementById("edit2").style.display = "none";
document.getElementById("blog").style.display = "none";
document.getElementById("sale1").style.display = "none";
document.getElementById("sale2").style.display = "block";
}

</script>



</body>
</html>
